package org.example.infrastructure.repository.orm.database;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.example.domain.model.entity.url.UrlShortenerAccessStats;
import org.example.domain.model.entity.url.req.UrlShortenerGroupStatsReq;
import org.example.domain.model.entity.url.req.UrlShortenerStatsReq;
import org.example.domain.repository.UrlShortenerAccessStatsRepository;
import org.example.infrastructure.persistence.orm.UrlShortenerAccessStatsMapper;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Slf4j
@RequiredArgsConstructor
public class MybatisUrlShortenerAccessStatsRepository implements UrlShortenerAccessStatsRepository {
    private final UrlShortenerAccessStatsMapper urlShortenerAccessStatsMapper;

    @Override
    public void insertUrlShortenerAccessStats(UrlShortenerAccessStats urlShortenerAccessStats){
        urlShortenerAccessStatsMapper.insertUrlShortenerAccessStats(urlShortenerAccessStats);
    }

    @Override
    public List<UrlShortenerAccessStats> listStatsByUrlShortener(UrlShortenerStatsReq urlShortenerStatsReq) {
        return urlShortenerAccessStatsMapper.listStatsByUrlShortener(urlShortenerStatsReq);
    }

    @Override
    public List<UrlShortenerAccessStats> hourStatsByUrlShortenerList(UrlShortenerStatsReq urlShortenerStatsReq) {
        return urlShortenerAccessStatsMapper.hourStatsByUrlShortenerList(urlShortenerStatsReq);
    }

    @Override
    public List<UrlShortenerAccessStats> weekdayStatsByUrlShortenerList(UrlShortenerStatsReq urlShortenerStatsReq) {
        return urlShortenerAccessStatsMapper.weekdayStatsByUrlShortenerList(urlShortenerStatsReq);
    }

    @Override
    public List<UrlShortenerAccessStats> urlShortenerAccessStatsByGroupList(UrlShortenerGroupStatsReq urlShortenerGroupStatsReq) {
        return urlShortenerAccessStatsMapper.urlShortenerAccessStatsByGroupList(urlShortenerGroupStatsReq);
    }

    @Override
    public List<UrlShortenerAccessStats> hourStatsByGroupList(UrlShortenerGroupStatsReq urlShortenerGroupStatsReq) {
        return urlShortenerAccessStatsMapper.hourStatsByGroupList(urlShortenerGroupStatsReq);
    }

    @Override
    public List<UrlShortenerAccessStats> weekdayStatsByGroupList(UrlShortenerGroupStatsReq urlShortenerGroupStatsReq) {
        return urlShortenerAccessStatsMapper.weekdayStatsByGroupList(urlShortenerGroupStatsReq);
    }


}
